<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="template/main.xhtml">

	<ui:define name="body">
		<p:messages id="mensajes" />
		<h:form id="form">
			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:commandButton title="#{messages['boton.eliminar']}" image="ui-icon-trash" onclick="confirmation.show()"
						type="button" immediate="true" ajax="false" />

					<p:confirmDialog message="#{messages['label.confirmar.eliminar']}" 
						header="#{messages['label.dialogo.titulo.eliminar']}!" severity="alert" widgetVar="confirmation"
						width="295" height="80"
						>

						<p:commandButton value="#{messages['boton.dialogo.si']}" action="#{parametroListMB.deleteSelection}"
							actionListener="#{parametroListMB.clear}" 
							ajax="false"/>
						<p:commandButton value="#{messages['boton.dialogo.no']}" onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
					
					<p:confirmDialog message="#{messages['label.confirmar.eliminar']}" 
						header="#{messages['label.dialogo.titulo.eliminar']}" severity="alert" widgetVar="eliminacion"
						width="295" height="80"
						>

						<p:commandButton value="#{messages['boton.dialogo.si']}" action="#{parametroListMB.eliminar}"
							actionListener="#{parametroListMB.clear}" immediate="true"
							ajax="false" />
						<p:commandButton value="#{messages['boton.dialogo.no']}" onclick="eliminacion.hide()" type="button" />
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>
			<p:focus context="list"></p:focus>
			<p:dataTable id="list" var="bean" value="#{parametroListMB.model}" rows="#{parametroListMB.pageSize}" 
					paginator="true" lazy="true"  emptyMessage="No hay datos" resizableColumns="true"
					paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
					paginatorPosition="bottom" paginatorAlwaysVisible="false"
					>   
			
				<f:facet name="header">#{messages['parametro.list.table.title']}</f:facet>
				<p:column style="width:5%;">
					<h:selectBooleanCheckbox value="#{parametroListMB.selection[bean.id]}" />
				</p:column>
				<p:column sortBy="#{bean.codigo}" filterBy="#{bean.codigo}">
					<f:facet name="header">#{messages['parametro.label.codigo']}</f:facet>
					<h:outputText value="#{bean.codigo}" />
				</p:column>
				<p:column sortBy="#{bean.descripcion}" filterBy="#{bean.descripcion}">
					<f:facet name="header">#{messages['parametro.label.descripcion']}</f:facet>
					<h:outputText value="#{bean.descripcion}" />
				</p:column>
				<p:column sortBy="#{bean.linea}" filterBy="#{bean.linea}">
					<f:facet name="header">#{messages['parametro.label.linea']}</f:facet>
					<h:outputText value="#{bean.linea}" />
				</p:column>  
				<p:column style="width:10%;">	
					<p:commandButton title="#{messages['boton.editar']}"  action="#{parametroListMB.getNextView}" actionListener="#{parametroListMB.clear}" icon="ui-icon-pencil" ajax="true">
						<f:param name="id" value="#{bean.id}" />
					</p:commandButton>
					<p:commandButton title="#{messages['boton.eliminar']}" onclick="eliminacion.show()" actionListener="#{parametroListMB.clear}" icon="ui-icon-trash" ajax="true">
						<f:param name="id" value="#{bean.id}" />
						<f:setPropertyActionListener value="#{bean}" target="#{parametroListMB.parametro}" />
					</p:commandButton>
				</p:column>
			</p:dataTable>
		</h:form>
	</ui:define>
</ui:composition>